///@file Element.cpp
///@brief Implementation of the class representing a mesh finite element
///@author Arnaud Duval
///@version 0.0
///@date 2010/02/26

#include "Element.h"

///@brief Default constructor
Element::Element()
{

}

///@brief Destructor
Element::~Element()
{
  
}

///@brief Direct access to reference of element
std::string& Element::Reference()
{
	return reference;
}
///@brief Direct acces to type of element
std::string& Element::Type()
{
	return type;
}

///@brief Set material
///@param m Pointer to assigned material
void Element::SetMaterial(Material* m)
{
	mat = m;
}

///@brief Update specific values of element
void Element::Update()
{

}

///@brief compute nodal residual from nodal DOF increment
///@param Du Increment of nodal DOF
///@param Df nodal residuals
///@param K stiffness matrix
void Element::Equilibrate(const Vector& Du, Vector &Df, Matrix &K)
{

}

///@brief Compute nodal residual from nodal DOF increment with similarities to Abaqus UEL
///@param Df nodal residuals
///@param K stiffness matrix
///@param vars evolution variables
///@param u nodal DOF at beginning of increment
///@param Du Increment of nodal DOF
void Element::UEL(Vector& Df, Matrix& K, Vector& vars, const Vector& u, const Vector& Du)
{
    std::cout << "UEL Generique\n";
}

///@brief Compute displacements interpolation matrix at a given intagration point
///@param idx index of integration point where the matrix should be computed
Matrix Element::N(unsigned int idx)
{
	Matrix res;
	return res;
}

///@brief Compute strain matrix operator at a given intagretio point
///@param id index of integration point where the matrix should be computed
Matrix Element::B(unsigned int id)
{
	Matrix res;
	return res;
}


///@brief Overload of operator <<
///@param s out stream
///@param e Element object to put in the out stream
std::ostream& operator<<(std::ostream& s, Element& e)
{
	s << e.reference.c_str() << "\n";
	for(std::list<Node*>::iterator i = e.nodes.begin(); i != e.nodes.end() ; i++)
		s << "\t" << **i << "\n";
	s << "\t" << *(e.mat) << "\n";
	return s;
}


